{extend name="public:_base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/uploadify/uploadify.css">
{/block}
{block name="js"}
{include file="public/_validform"}

<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/admin/hui/lib/ueditor/1.4.3/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/admin/hui/lib/ueditor/1.4.3/ueditor.all.js"></script>
<!-- 下载文件 -->
<script src="__STATIC__/admin/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/upfile.js" type="text/javascript"></script>

<script type="text/javascript">
    var URL = {
        uploader: "{:url('Upload/image')}",
        swf: "__STATIC__/admin/uploadify/uploadify.swf",
        ROOT: "__ROOT__/uploads/image",
    }

    var array = [{$data.type ?? ''}];
    for (var k = 0, length = array.length; k < length; k++) {
        $("[name='nav_id[]'][value=\'" + array[k] + "\']").attr("checked", true);
    }

    upload_image('image','','800','200','800');
</script>
{/block}
{block name="main"}

<div class="page-container">
    
    <form action="{:url('Carousel/save')}" method="post" class="form form-horizontal" id="form">
        
        <table class="table table-border table-bordered table-bg mt-20">
            <thead>
                <tr>
                    <th colspan="2" scope="col">填写信息</th>
                </tr>
            </thead>
            
            <tbody>
                <tr>
                    <th>
                        <span class="c-red">*</span>图片 1920*440：
                    </th>
                    <td>
                        <div id="image_s">
                            <a href="__ROOT__/uploads/{$data.image ?'image/'.$data.image: 'sm_nopic.jpg'}" target="_blank">
                                <img src="__ROOT__/uploads/{$data.image ?'image/'.$data.image: 'sm_nopic.jpg'}" width="800px" height="200px" /> 
                            </a>
                        </div>
                        <input class="input-text" name="image" type="hidden" id="image_post" value="{$data.image ?? ''}"/>
                        <input class="input-text" name="old_image" type="hidden" value="{$data.image ?? ''}"/>
                        <input id="image" name="file_upload" type="file" multiple="true">
                        <a href="__ROOT__/{$data.file ?? ''}">{$data.file ?'下载': ''}</a>
                    </td>
                </tr>
                
                <tr>
                    <th>
                        标题：
                    </th>
                    <td>
                        <input type="text" class="input-text" value="{$data.title ?? ''}" placeholder="" name="title">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        链接：
                    </th>
                    <td>
                        <input id="file_size" type="url" class="input-text" value="{$data.url ?? ''}" placeholder="http://localhost/" name="url">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        排序：
                    </th>
                    <td>
                        <input name="sort" type="number" class="input-text" placeholder="50" value="{$data.sort ?? '0' }">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        所属栏目：
                    </th>
                    <td>
                        <table class="table table-border table-bordered table-bg table-hover table-sort">
                            <thead>
                                <tr class="text-c">
                                    <th width="40"><input name="nav" type="checkbox" >所有栏目</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="text-c">
                                    <td>
                                        <p><input name="nav_id[]" type="checkbox" value="0" >首页</p>
                                        {volist name="nav" id="vo"}
                                        <p><input name="nav_id[]" type="checkbox" value="{$vo.id}" >{$vo.level}{$vo.name}</p>
                                        {/volist}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </tbody>
            
            <tfoot>
                <tr>
                    <th></th>
                    <td>
                        <input type="hidden" value="{$data.id ?? ''}" name="id">
                        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                        <button onClick="layer_close();" class="btn btn-default radius" type="button">
                            &nbsp;&nbsp;取消&nbsp;&nbsp;
                        </button>
                    </td>
                </tr>
            </tfoot>
            
        </table>

    </form>
</div>
{/block}
